{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# 使用C语言的7 个步骤"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 第1步：定义程序的目标\n",
    "- 第2步：设计程序\n",
    "- 第3步：编写代码\n",
    "- 第4步：编译\n",
    "- 第5步：运行程序\n",
    "- 第6步：测试和调试程序\n",
    "- 第7步：维护和修改代码\n",
    "\n",
    "\n",
    "<img style=\"float: middle;\" src=\".\\img\\C1_Fig_01.png\" width=600 height=400>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# C语言程序解剖"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img style=\"float: middle;\" src=\".\\img\\C1_Fig_02.png\" width=600 height=400>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#include <stdio.h>\n",
    "\n",
    "该行告诉编译器把stdio.h中的内容包含在当前程序中。stdio.h是C编译器软件包的标准部分，它提供键盘输入和屏幕输出的支持。\n",
    "\n",
    "int main(void ){ /*一个简单的C程序*/\n",
    "\n",
    "C程序包含一个或多个函数，它们是C程序的基本模块。程序中有一个名为main()的函数。圆括号表明main()是一个函数名。int表明main()函数返回一个整数，void表明main()不带任何参数。\n",
    "\n",
    "int num;     /*定义一个名为num的变量；*/\n",
    "\n",
    "该声明表明，将使用一个名为num的变量，而且num是int（整数）类型。\n",
    "\n",
    "num = 1;    /* 为num赋值*/\n",
    "\n",
    "语句num = 1;把值1赋给名为num的变量。\n",
    "\n",
    "printf(\"I am a simple\");   /* 使用printf()函数*/\n",
    "\n",
    "该语句使用 printf()函数，在屏幕上显示 I am a simple，光标停在同一行。printf()是标准的C库函数。在程序中使用函数叫作调用函数。\n",
    "\n",
    "printf(\"computer.\\n\");\n",
    "\n",
    "接下来调用的这个printf()函数在上条语句打印出来的内容后面加上“computer”。代码\\n告诉计算机另起一行，即把光标移至下一行。\n",
    "\n",
    "printf(\"My favorite number is %d. Because it is first.\\n\", num);\n",
    "\n",
    "最后调用的printf()把num的值（1）内嵌在用双引号括起来的内容中一并打印。%d告诉计算机以何种形式输出num的值，打印在何处。\n",
    "\n",
    "return 0;\n",
    "\n",
    "C函数可以给调用方提供（或返回）一个数。目前，可暂时把该行看作是结束main()函数的要求。\n",
    "\n",
    "}\n",
    "\n",
    "左花括号表示函数定义开始，右花括号（}）表示函数定义结束。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
